package com.dkd.easybook.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.dkd.common.annotation.Log;
import com.dkd.common.core.controller.BaseController;
import com.dkd.common.core.domain.AjaxResult;
import com.dkd.common.enums.BusinessType;
import com.dkd.easybook.domain.EbUserRemindCategory;
import com.dkd.easybook.service.IEbUserRemindCategoryService;
import com.dkd.common.utils.poi.ExcelUtil;
import com.dkd.common.core.page.TableDataInfo;

/**
 * 用户提醒类别Controller
 *
 * @author itheima
 * @date 2024-12-13
 */
@Api(tags = "用户提醒类别Controller")
@RestController
@RequestMapping("/easybook/userRemindCat")
public class EbUserRemindCategoryController extends BaseController
{
    @Autowired
    private IEbUserRemindCategoryService ebUserRemindCategoryService;

    /**
     * 查询用户提醒类别列表
     */
    @ApiOperation("查询用户提醒类别列表")
    @PreAuthorize("@ss.hasPermi('easybook:userRemindCat:list')")
    @GetMapping("/list")
    public TableDataInfo list(EbUserRemindCategory ebUserRemindCategory)
    {
        startPage();
        List<EbUserRemindCategory> list = ebUserRemindCategoryService.selectEbUserRemindCategoryList(ebUserRemindCategory);
        return getDataTable(list);
    }

    /**
     * 导出用户提醒类别列表
     */
    @ApiOperation("导出用户提醒类别列表")
    @PreAuthorize("@ss.hasPermi('easybook:userRemindCat:export')")
    @Log(title = "用户提醒类别", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EbUserRemindCategory ebUserRemindCategory)
    {
        List<EbUserRemindCategory> list = ebUserRemindCategoryService.selectEbUserRemindCategoryList(ebUserRemindCategory);
        ExcelUtil<EbUserRemindCategory> util = new ExcelUtil<EbUserRemindCategory>(EbUserRemindCategory.class);
        util.exportExcel(response, list, "用户提醒类别数据");
    }

    /**
     * 获取用户提醒类别详细信息
     */
    @ApiOperation("获取用户提醒类别详细信息")
    @PreAuthorize("@ss.hasPermi('easybook:userRemindCat:query')")
    @GetMapping(value = "/{userCategoryId}")
    public AjaxResult getInfo(@PathVariable("userCategoryId") Long userCategoryId)
    {
        return success(ebUserRemindCategoryService.selectEbUserRemindCategoryByUserCategoryId(userCategoryId));
    }

    /**
     * 新增用户提醒类别
     */
    @ApiOperation("新增用户提醒类别")
    @PreAuthorize("@ss.hasPermi('easybook:userRemindCat:add')")
    @Log(title = "用户提醒类别", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EbUserRemindCategory ebUserRemindCategory)
    {
        return toAjax(ebUserRemindCategoryService.insertEbUserRemindCategory(ebUserRemindCategory));
    }

    /**
     * 修改用户提醒类别
     */
    @ApiOperation("修改用户提醒类别")
    @PreAuthorize("@ss.hasPermi('easybook:userRemindCat:edit')")
    @Log(title = "用户提醒类别", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EbUserRemindCategory ebUserRemindCategory)
    {
        return toAjax(ebUserRemindCategoryService.updateEbUserRemindCategory(ebUserRemindCategory));
    }

    /**
     * 删除用户提醒类别
     */
    @ApiOperation("删除改用户提醒类别")
    @PreAuthorize("@ss.hasPermi('easybook:userRemindCat:remove')")
    @Log(title = "用户提醒类别", businessType = BusinessType.DELETE)
	@DeleteMapping("/{userCategoryIds}")
    public AjaxResult remove(@PathVariable Long[] userCategoryIds)
    {
        return toAjax(ebUserRemindCategoryService.deleteEbUserRemindCategoryByUserCategoryIds(userCategoryIds));
    }
}
